package com.wangnan.currentactivity;

import android.app.Application;
import android.content.Context;
import android.content.res.Configuration;
import android.util.Log;

import com.wangnan.currentactivity.Dao.BillListDao;
import com.wangnan.currentactivity.Dao.BillListDatabase;
import com.wangnan.currentactivity.Dao.BillListViewModel;
import com.wangnan.currentactivity.ui.UserBillBean;

import java.util.ArrayList;
import java.util.List;

import androidx.annotation.NonNull;
import androidx.multidex.MultiDex;

/*
 * Package    :com.wangnan.currentactivity
 * ClassName  :BaseApplication
 * @Author android张
 * @Date: 2020/1/25
 */
public class BaseApplication extends Application {
	public static final String             TAG             = "BaseApplicationapp";
	public static       List<UserBillBean> userDetailsList = new ArrayList<>();
	public static       int                isFistWx        = 0;   //判断是否是第一次进入微信账单详情   0
	public static       int                isFistMt        = 0;   //判断是否是第一次进入美团账单详情   0
	public static       int                isDetail        = 0;    //1微信 2美团  0 未进入
	public static       int                A               = 0;
	public static       BillListDatabase   billListDatabase;
	public static       BillListDao        billListDao;
	public static       BillListViewModel  billListViewModel;
	private static Context mContext;
	//初始回调方法
	@Override
	public void onCreate() {
		super.onCreate();
		MultiDex.install(this);
		Log.d(TAG, "onCreate: " + Thread.currentThread());
		mContext = this;

	}
	//系统配置发生变更的时候，比如语言发生变化，屏幕发生切换等,onConfigurationChanged会被调用，
	// newConfig是新的配置信息

	@Override
	public void onConfigurationChanged(@NonNull Configuration newConfig) {
		super.onConfigurationChanged(newConfig);
		Log.d(TAG, "onConfigurationChanged: " + "newConfig" + newConfig);
	}

	//app内存低的时候回调
	@Override
	public void onLowMemory() {
		super.onLowMemory();
	}


	// 获取全局上下文对象
	public static Context getGlobalApplication(){
		return mContext;
	}

}